package com.googlecode.dgwt.client.dijit.form;

import com.google.gwt.event.dom.client.ClickHandler;
import com.googlecode.dgwt.client.dijit.Dijit;
import com.googlecode.dgwt.client.dijit.form.base.ButtonBase;
import com.googlecode.dgwt.client.dijit.theme.CSS;

/**
 * @author wellsantos@wellsantos.com
 * @since 0.01
 */
public class Button extends ButtonBase {


    /**
     * Creates a button with no caption.
     */
    public Button() {
        super(true);
    }

    
    /**
     * Creates a button with the given HTML caption.
     * 
     * @param html the HTML caption
     */
    public Button(String html) {
        this();
        setHTML(html);
    }


    /**
     * Creates a button with the given HTML caption and click handler.
     * 
     * @param html the HTML caption
     * @param handler the click handler
     */
    public Button(String html, ClickHandler handler) {
        this(html);
        addClickHandler(handler);
    }

    
    protected Button(boolean ready) {
        super(ready);
    }


    @Override
    public CSS getThemeCSS() {
        return Dijit.getTheme().dijitButton();
    }

    @Override
    protected void buildRendering() {
        loadFromTemplate(Dijit.TEMPLATE_RESOURCES.button());
    }
    
    
}
